<?php
class classOrderService{
    public function getPaymentName($iPaymentID){
        if(is_numeric($iPaymentID) and $iPaymentID>0){
            $sql_result = mysql_query("SELECT pt_name FROM payment_types WHERE id=".$iPaymentID);
            $sql_object = mysql_fetch_object($sql_result);
            return $sql_object->pt_name;
        }
        else
          return "";
    }
    public function getDeliveryName($iDeliveryID){
        if(is_numeric($iDeliveryID) and $iDeliveryID>0){
            $sql_result = mysql_query("SELECT dt_name FROM delivery_types WHERE id=".$iDeliveryID);
            $sql_object = mysql_fetch_object($sql_result);
            return $sql_object->dt_name;
        }
        else
          return "";
    }
    public function getOrderNO($iOrderID){
        if(is_numeric($iOrderID) and $iOrderID>0){
            $sql_result = mysql_query('SELECT ID, NO, Order_Create FROM order_heads WHERE ID='.$iOrderID);
            $sql_obj = mysql_fetch_object($sql_result);

            if($sql_obj->NO == '') $OrderNO = $sql_obj->ID;
            else $OrderNO = date('Y',strtotime($sql_obj->Order_Create)).'/'.$sql_obj->NO;

            return $OrderNO;
        }
        else return '';
    }
    public function getWasOrderMadeByRegisteredUser($iOrderID){
        if(is_numeric($iOrderID) and $iOrderID>0){
            $sql_result = mysql_query('SELECT OH_UserID FROM order_heads WHERE ID='.$iOrderID);
            $sql_obj = mysql_fetch_object($sql_result);

            if($sql_obj->OH_UserID != '') {
                if($sql_obj->OH_UserID == 0) return false;
                if($sql_obj->OH_UserID > 0) return true;
            }
        }
        else return '';
    }
}
?>
